<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="../static/knockout-3.3.0.js"></script>

</head>
<body>

	console is:
	<span data-bind="text:res"></span>

</body>

<script type="text/javascript">
	function changeAge() {
		myViewModel.personAge(21);
	}

	function nameAndAgeModel() {
		this.personName = ko.observable("Bod");
		this.personAge = ko.observable(21);
		this.res = ko.computed(function() {
			return this.personName() + " is :" + this.personAge()
					+ " years old!"
		}, this)
	}

	var myViewModelArray = ko.observableArray([ {
		name : 'roy',
		age : '25'
	}, {
		name : 'today',
		age : '25'
	} ]);
	alert("The length of the array is :" + myViewModelArray().length);
	alert("The first element is:" + myViewModelArray()[0]);

	/* var myViewModel = {
		personName : ko.observable("Bob"),
		personAge : ko.observable(10)

	}; */
	ko.applyBindings(myViewModelArray);
	ko.applyBindings(nameAndAgeModel);
</script>
</html>